package com.shengchao.examstar.rpc.question.enums;

import lombok.Getter;

import java.util.Objects;

public enum UserQuestionSetStatusEnum {
    UNDO(1, "未开始"),
    //进行中
    DOING(2, "进行中"),
    //已完成
    DONE(3, "已完成");
    @Getter
    private final Integer code;
    @Getter
    private final String value;

    UserQuestionSetStatusEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public static UserQuestionSetStatusEnum of(Long questionSum, Long doQuestionSum) {
        if (Objects.equals(questionSum, doQuestionSum)) {
            return DONE;
        } else if (doQuestionSum==0) {
            return UNDO;
        } else {
            return DOING;
        }
    }
}
